package org.cadad;

import android.app.Activity;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class RyanairppActivity extends TabActivity {

	Resources				mResources;
	TabHost					mTabHost;
	static public Activity	gActivity	= null;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.main);

		mResources = getResources(); // Resource object to get Drawables
		mTabHost = getTabHost(); // The activity TabHost
		addTabUno();
		addTabDos();

		setTabColor(mTabHost);
		mTabHost.setCurrentTab(0);

	}

	public static void setTabColor(TabHost tabhost) {

		// for (int i = 0; i < tabhost.getTabWidget().getChildCount(); i++) {
		// tabhost.getTabWidget().getChildAt(i).setBackgroundColor(Color.parseColor("#CCFF0000"));
		// }
		// tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()).setBackgroundColor(Color.parseColor("#0000FF"));
	}

	private void addTabUno() {
		Intent intent = new Intent(this, Tab_Uno.class);
		TabSpec spec = mTabHost.newTabSpec("Texto Tab1");
		spec.setIndicator("Tab1", mResources.getDrawable(android.R.drawable.ic_menu_day));
		spec.setContent(intent);
		mTabHost.addTab(spec);
	}

	private void addTabDos() {
		Intent intent = new Intent(this, Tab_Dos.class);
		TabSpec spec = mTabHost.newTabSpec("Texto Tab2");
		spec.setIndicator("Tab2", mResources.getDrawable(android.R.drawable.ic_menu_month));
		spec.setContent(intent);
		mTabHost.addTab(spec);
	}

	// @Override
	// public void onTabChanged(String tabId) {
	//
	// Log.i("******ANN CLICK TAB NUMBER", "------" + tabId);
	// for (int i = 0; i < mTabHost.getTabWidget().getChildCount(); i++) {
	// mTabHost.getTabWidget().getChildAt(i).setBackgroundResource(Color.BLUE);
	// }
	// mTabHost.getTabWidget().getChildAt(mTabHost.getCurrentTab()).setBackgroundResource(Color.YELLOW);
	// }

}